package com.wgts.wgts.dagger.module;

import android.content.Context;

import com.wgts.wgts.dagger.scope.ActivityScope;
import com.wgts.wgts.dagger.scope.ApplicationScope;
import com.wgts.wgts.netmodle.AppOkHttpClient;
import com.wgts.wgts.netmodle.NetService;
import com.wgts.wgts.netmodle.NetWorkFactory;
import com.wgts.wgts.tools.AppInfor;
import com.wgts.wgts.tools.CountDownTime;
import com.wgts.wgts.tools.SharedpreferencesHelper;
import com.wgts.wgts.tools.VipMessageDate;

import dagger.Module;
import dagger.Provides;

@Module
public class AppModule {

    private Context applicationContext;

    public AppModule(Context applicationContext) {
        this.applicationContext = applicationContext;
    }

    @Provides
    @ApplicationScope
    public Context provideContext(){
        return applicationContext;
    }

    @Provides
    @ApplicationScope
    public AppOkHttpClient provideOkHttp(){
        return AppOkHttpClient.getInstance();
    }

    @Provides
    @ApplicationScope
    public NetWorkFactory provideNetWork(AppOkHttpClient appOkHttpClient){
        return NetWorkFactory.getInstance(appOkHttpClient);
    }

    @Provides
    @ApplicationScope
    public CountDownTime provideCountDown(){
        return CountDownTime.getInstance();
    }

    @Provides
    @ApplicationScope
    public SharedpreferencesHelper provideSharedpreferencesHelper(Context context){
        return SharedpreferencesHelper.getInstance().init(context);
    }

    @Provides
    @ApplicationScope
    public AppInfor provideAppInfo(Context context, SharedpreferencesHelper sharedpreferencesHelper){
        return AppInfor.getInstance().init(context, sharedpreferencesHelper);
    }

    @Provides
    @ApplicationScope
    public NetService provideNetService(NetWorkFactory netWorkFactory, AppInfor appInfor){
        return NetService.getInstance(netWorkFactory, appInfor);
    }

    @Provides
    @ApplicationScope
    public VipMessageDate vipMessageDate(){
        return VipMessageDate.getInstance();
    }

}
